package com.ftg.learn.framework.spring.xml;


import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 测试
 *
 * @author kangjx
 * @version 1.0
 * @date 2023/9/18 上午11:08
 */
public class MyContainerDemo {

    public static void main(String[] args) {
        BeanFactory jd = new ClassPathXmlApplicationContext("spring.xml");

        //getBean(Milk.class) 按类型查找 more
        Milk milk1 =jd.getBean(Milk.class);
        milk1.setType("禾");

        //getBean("milk1"); 按名称查找
        Milk milk2 = (Milk) jd.getBean("milk1");

        System.out.println(milk1.getType());
        System.out.println(milk2.getType());
    }

}
